<html data-layout-decorator="layout/form">
<div data-layout-fragment="content">
    <form class="layui-form model-form" action="" >
        <input name="id" type="hidden" th:value="${info['id']}?:0">
        <div class="layui-form-item">
            <label class="layui-form-label">角色名称：</label>
            <div class="layui-input-block">
                <input name="name" th:value="${info['name']}" lay-verify="required" autocomplete="off" placeholder="请输入角色名称" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态：</label>
            <div class="layui-input-block">
                <input name="status" id="status" th:value="1" lay-skin="switch" lay-filter="status" lay-text="正常|禁用"
                       type="checkbox" th:checked="${info['status']==2}?false:true">
                <script th:inline="javascript" type="text/javascript">layui.use(['form'], function(){
                var form = layui.form,
                    $ = layui.$;
                if (1 == 1) {
                    $("#status").attr('type', 'hidden').val(1);
                } else {
                    $("#status").attr('type', 'hidden').val(2);
                }
                form.on('switch(status)', function(data) {
                    $(data.elem).attr('type', 'hidden').val(this.checked ? 1 : 2);
                });
            });</script>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">排序：</label>
            <div class="layui-input-block">
                <input name="sort" th:value="${info['sort']}" lay-verify="required|number" autocomplete="off" placeholder="请输入排序" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item text-center ">
            <button class="layui-btn" lay-filter="submitForm" lay-submit="">立即保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">关闭</button>
        </div>    </form>
</div>
</html>